package com.ctsi.system.domain;

import com.ctsi.commons.util.id.UUIDGenerator;

import java.io.Serializable;
import java.util.Calendar;

/**
 * @author zhangjw
 * @className WorkCalendar
 * @description TODO
 * @date 2019/3/30 13:04
 **/
public class WorkCalendar implements Serializable {

    private String id;
    private long serialNo;
    private int workYear;
    private int workMonth;
    private int workDay;
    private String dataObjectId;

    public WorkCalendar() {

    }

    public WorkCalendar(Calendar c, String dataObjectId) {
        id = UUIDGenerator.getId();
        workYear = c.get(Calendar.YEAR);
        workMonth = c.get(Calendar.MONDAY) + 1;
        workDay = c.get(Calendar.DAY_OF_MONTH);
        serialNo = c.getTimeInMillis();
        this.dataObjectId = dataObjectId;
    }

    public boolean equals(Calendar c) {
        if (c == null)
            return false;
        return workYear == c.get(Calendar.YEAR) && workMonth == c.get(Calendar.MONDAY) + 1 && workDay == c.get(Calendar.DAY_OF_MONTH);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(long serialNo) {
        this.serialNo = serialNo;
    }


    public int getWorkYear() {
        return workYear;
    }

    public void setWorkYear(int workYear) {
        this.workYear = workYear;
    }

    public int getWorkMonth() {
        return workMonth;
    }

    public void setWorkMonth(int workMonth) {
        this.workMonth = workMonth;
    }

    public int getWorkDay() {
        return workDay;
    }

    public void setWorkDay(int workDay) {
        this.workDay = workDay;
    }

    public String getDataObjectId() {
        return dataObjectId;
    }

    public void setDataObjectId(String dataObjectId) {
        this.dataObjectId = dataObjectId;
    }

}
